import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class CustomAlertDialog extends StatelessWidget {
  const CustomAlertDialog({
    super.key,
    required this.title,
    this.subtitle,
    this.content,
    this.onpressed,
  });

  final String title;
  final String? subtitle;
  final Widget? content;
  final VoidCallback? onpressed;

  @override
  Widget build(BuildContext context) {
    return CupertinoAlertDialog(
        title: Column(
          children: [
            Text(title),
            const SizedBox(
              height: 8.0,
            ),
            Text(
              subtitle ?? "",
              style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w300),
            ),
            const SizedBox(
              height: 12.0,
            )
          ],
        ),
        content: content,
        actions: [
          CupertinoDialogAction(
              child: const Text(
                "取消",
                style: TextStyle(
                    color: Colors.black,
                    fontSize: 18,
                    fontWeight: FontWeight.bold),
              ),
              onPressed: () {
                Get.back();
              }),
          CupertinoDialogAction(
              child: const Text(
                "确定",
                style: TextStyle(
                    color: Colors.black,
                    fontSize: 18,
                    fontWeight: FontWeight.bold),
              ),
              onPressed: () async {
                //执行操作
                onpressed;
                Get.back();
              })
        ]);
  }
}
